home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
rexx
/
arexx
/
startrek.lzh
/
StarTrek
/
st.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1989-12-08
|
34KB
|
1,364 lines
/* *****************************************************
** **
** STAR TREK - THE FINAL FRONTIER **
** **
** Written By Steve Berry **
** **
** Rev A - 4/24/87 IBM 370 **
** **
** Inputs: filename (saved game) **
** **
** Rev B - 5/21/88 **
** modified to run on Amiga **
** **
***************************************************** */
arg fn .
address command
call time 'R' /* reset timer */
stardate = time('E')
junk = randu(time('S'))
/* Begining of main routine */
say ''
say ' Please be patient... making galaxy'
say ''
mission = 1
/* Are we playing an OLD Game? */
if fn ~= '' then
call load_old_game fn
else
newmission:
select
when mission = 1 then call init_variables_1
when mission = 2 then call init_variables_2
when mission = 3 then call init_variables_3
when mission = 4 then call init_variables_4
when mission = 5 then call init_variables_5
when mission = 6 then call init_variables_6
when mission = 7 then call init_variables_7
when mission = 8 then call init_variables_8
when mission = 9 then call init_variables_9
when mission = 10 then call init_variables_10
/* otherwise */
end
/* ************ */
/* Main do loop */
/* ************ */
do until energy = 0
'cls'
call print_quadrent x,y,ex,ey
t0 = time('R')
/* get user input and parse the commands */
say 'Your command Captain?'
pull instring
rc = parse_command(instring)
/* process the commands */
if rc = 0 then do
do loop = 1 to 3
if arg1.loop = '' then leave
call process_command arg1.loop,arg2.loop
if alive = 'no' | energy <= 0 then leave
end
end
else say 'Captain I am sorry but I cant understand you.'
/* Check for illegal input */
if missstat = 'completed' then do
'cls'
say ''
say ' CONGRATULATIONS !!! You have completed Mission' mission
say ''
mission = mission + 1
if mission = 11 then do
say ' WOW YOU ARE AWESOME !! Ever think of running for office?'
say ' game over.'
exit 0
end
end
/* Did player kill himself? */
If alive = 'no' | energy <= 0 then do
'cls'
say ''
say ''
say ''
say ''
say ' Suicide is not in the BEST interests of the FEDERATION.'
say ''
say ' But you did get 'points' points.'
say ''
say ''
say ''
say 'game over.'
say ''
say ''
exit
end
/* Time for a little wear and tear on the enterprize */
call wear_and_tear
/* Is the Enterprize DEAD in Space? */
If alive = 'no' then do
'cls'
say ''
say ''
say ''
say ''
say ' Sorry but you let the Enterprize deterioriate into '
say ' into a rusting hunk of space debris.'
say ''
say ' But you did get 'points' points.'
say ''
say ''
say ''
say 'game over.'
say ''
say ''
exit
end
/* Ok. now it's the Bad guy's turn */
/* now call mission specific routine */
/* for bad guy routine and points awarded */
select
when mission = 1 then call mission1
when mission = 2 then call mission2
when mission = 3 then call mission3
when mission = 4 then call mission4
when mission = 5 then call mission5
when mission = 6 then call mission6
when mission = 7 then call mission7
when mission = 8 then call mission8
when mission = 9 then call mission9
when mission = 10 then call mission10
end
/* Is the Enterprize KILLED? KRUSHED? DESTROYED? */
If alive = 'no' then do
say ''
say ''
say ''
say ''
say ' Sorry but you let Your crew and the Federation down.'
say ' Perhaps you should consider another career.'
say ''
say ' But you did get 'points' points.'
say ''
say ''
say ''
say 'game over.'
say ''
say ''
exit
end
/* end of the loop - now go print the screen */
end
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE SECTION */
/* ********************************************** */
/* ********************************************** */
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE LOAD_OLD_GAME */
/* PASSED VALUES - fn */
/* ********************************************** */
/* ********************************************** */
load_old_game:
arg fn
bstr = ' <*> * |o|(B))\_ # '
missstat = 'not yet'
/* get variables */
if ~Open(fnn,fn,'R') then exit -99
inn = Readln(fnn)
push inn
parse pull stardate mission energy points x y ex ey shields klshields docked kltot
inn = Readln(fnn)
push inn
pull status.0 status.1 status.2 status.3 status.4 status.5
/* start interval timer */
stardate = stardate + time('E')
/* Load galactic map */
do l = 0 to 9
inn1 = Readln(fnn)
inn2 = Readln(fnn)
push inn1; push inn2
pull map.l.5 map.l.6 map.l.7 map.l.8 map.l.9
pull map.l.0 map.l.1 map.l.2 map.l.3 map.l.4
end
do l = 0 to 9
inn1 = Readln(fnn)
inn2 = Readln(fnn)
push inn1; push inn2
pull quad.l.5 quad.l.6 quad.l.7 quad.l.8 quad.l.9
pull quad.l.0 quad.l.1 quad.l.2 quad.l.3 quad.l.4
end
alive = 'yes'
junk = Close(fnn)
call newscreen
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE INIT_VARIABLES_1 */
/* PASSED VALUES - none */
/* ********************************************** */
/* ********************************************** */
init_variables_1:
bstr = ' <*> * |o|(B))\_ # '
alive = 'yes'
energy = 1000000
x = 0
y = 0
points = 0
mission = 1
shields = 'down'
kltot = 0
missstat = 'not yet'
do a = 0 to 9
do b = 0 to 9
map.a.b = random(0,1) * 100 + random(0,1)*10 + random(0,9)
if map.a.b > 99 then kltot = kltot + 1
end
end
klshields = 5000
status.0 = 0
status.1 = 0
status.2 = 0
status.3 = 0
status.4 = 0
status.5 = 0
ex = 5
ey = 4
/* Welcome the player */
'cls'
say 'Star Trek'
say ''
say ' ___---___'
say ' -- --'
say ' -- --'
say ' - -'
say ' -- ( ) --'
say ' -- --'
say ' (*)-- _ --(*)'
say ' | | --| |-- | |'
say ' | | / | \ | |'
say ' | |\ |\___/| /| |'
say ' | |\ \| |/ /| |'
say ' | | \| |/ | |'
say ' |_| | | |_|'
say ' \___/'
say ''
say ''
say ''
say ' Welcome to MISSION 1'
say ' hit return to continue '
pull junk
'cls'
say ''
say 'MISSION1: WAR with the KLINGONS!'
say ''
say ' OBJECTIVE: Destroy all Klingon invaders in this galaxy.'
say ''
say 'Good luck Jim!'
say ''
say ' Starfleet transmission ended.'
say ' hit return to continue '
pull junk
newscreen:
/* initialize quadrent matrix */
enemies = map.x.y%100
bases = (map.x.y - enemies * 100)%10
stars = map.x.y - enemies * 100 - bases * 10
/* zero quad matrix */
do i = 0 to 9
do j = 0 to 9
quad.i.j = 0
end
end
/* locate the enterprize */
quad.ex.ey = 1
/* put the stars in */
do a = 0 to stars - 1
rx = random(0,9)
ry = random(0,9)
if quad.rx.ry = 0 then quad.rx.ry = 2
else a=a-1
end
/* enemies? */
if enemies ~= 0 then do
do a = 0 to enemies - 1
rx = random(0,9)
ry = random(0,9)
if quad.rx.ry = 0 then quad.rx.ry = 3
else a=a-1
end
end
/* bases ? */
if bases ~= 0 then do
do a = 0 to bases - 1
rx = random(0,9)
ry = random(0,9)
if quad.rx.ry = 0 then quad.rx.ry = 4
else a=a-1
end
end
docked = 'no'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE PRINT_QUARDENT */
/* PASSED VALUES - x, y ,ex ,ey */
/* ********************************************** */
/* ********************************************** */
print_quadrent:
call dock? /* check to see if the Enterprize is docked */
stardate = stardate + time('E')
if status.5 < 1 | docked = 'yes' then astr = bstr
else astr = 'XXX<*>XXXXXXXXXXXXXXX'
say ' -------------Y->--------------'
do i0 = 0 to 9
line = ' :'
do j0 = 0 to 9
line = line || substr(astr,quad.i0.j0 * 3 + 1,3)
end
select
when i0 = 0 then line = line || ': Stardate 'stardate
when i0 = 1 then line = line || 'X Energy 'energy
when i0 = 2 then line = line || ': Quadrent' x',' y
when i0 = 3 then line = line || ': Sector 'ex',' ey
when i0 = 4 & docked = 'yes' then line = line || ': CONDITION DOCKED'
when i0 = 4 & map.x.y > 99 & docked = 'no' then line = line || ': CONDITION RED'
when i0 = 4 & map.x.y < 100 & docked = 'no' then line = line || ': Condition Green'
when i0 = 5 then line = line || ': Shields' shields
when i0 = 6 then line = line || ': Mission' mission
when i0 = 7 then line = line || ': Klingons left' kltot
when i0 = 9 then line = line || ': Points' points
otherwise line = line || ':'
end
say line
end
say ' ------------------------------'
say ''
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE PARSE_COMMAND */
/* PASSED VALUES - INSTRING */
/* ********************************************** */
/* ********************************************** */
parse_command:
parse arg arg1.1 arg2.1 arg1.2 arg2.2 arg1.3 arg2.3
/* string for recognition of commands */
comstr = 'COMFIRTORPHADISMAPSHOSENLONRAILOWSHIWARIMPLAUPROCAPLOGTRASHIDOWSAVGAMINSQUIDRISTAHEL'
/* Check for no input */
if arg1.1 = '' then return -1
/* trash all but the first three letters of each command */
do i = 1 to 3
arg1.i = left(arg1.i,3)
arg2.i = left(arg2.i,3)
if arg1.i = '' then leave
do j = 0 to 27
if arg1.i = substr(comstr,j * 3 + 1,3) then leave
end
if j > 27 then return -1
if arg2.i = '' then return 0
do j = 0 to 27
if arg2.i = substr(comstr,j * 3 + 1,3) then leave
end
if j > 27 then return -1
end
return 0
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE PROCESS_COMMAND */
/* PASSED VALUES - word1 , word2 */
/* ********************************************** */
/* ********************************************** */
process_command:
arg word1,word2
select
when word1 = 'FIR' then call weapon_control word2
when word1 = 'COM' then call compute word2
when word2 = 'SEN' then call sensors word1
when word2 = 'SHI' then call shield_control word1
when word2 = 'DRI' then call engine_control word1
when word1 = 'INS' then call instructions
when word2 = 'INS' then call instructions
when word1 = 'HEL' then call instructions
when word1 = 'SAV' then call save_game word2
when word1 = 'DIS' then call display_info word2
when word1 = 'LAU' then call launch_probe word2
when word1 = 'CAP' then call captains_log word2
when word1 = 'QUI' then exit
otherwise say 'Sorry - that function is not ready yet'
end
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE WEAPON_CONTROL */
/* PASSED VALUES - weapon */
/* ********************************************** */
/* ********************************************** */
weapon_control:
arg weapon
if (weapon ~= 'PHA') & (weapon ~= 'TOR') then do
say ''
say 'You want to fire what? What the hell is that?'
return
end
/* Phasers section */
if weapon = 'PHA' then do
if map.x.y < 100 then do
say ''
say 'Excuse me captain but there really is nothing to fire on!'
say ''
return
end
/* compute the distance between Enterprize and Klingon */
kx = 0
ky = 0
do i = 0 to 9
do j = 0 to 9
if quad.i.j = 3 then do
kx = i
ky = j
end
end
end
/* compute the distance (rough approximation) */
distance = ((ex-kx)**2 + (ey-ky)**2)
do i = 1 to 13 by .5
t0 = distance/i
if t0 < i then leave
end
distance = i
energy = energy - 5000
hit = (1 - status.1)* 5000 - (distance * 500)
if hit < 0 then hit = 0
klshields = klshields - hit
say ''
say 'PHASERS LOCKED ON TARGET CAPTAIN'
say ''
say 'Phasers fired - '
if klshields <= 0 then do
say 'KILINGON HIT WITH -' hit ' units of energy'
say '*** KLINGON DESTROYED! ***'
points = points + 50
klshields = 5000
quad.kx.ky = 0
map.x.y = map.x.y - 100
kltot = kltot - 1
say ''
say ''
say ''
end
else
do
say 'KILINGON HIT WITH -' hit ' units of energy'
say ' He is still alive Captain!'
say ''
say ''
end
end /* end of phaser routine */
else
/* Torpedo routine */
do
say ''
say 'Torpedoes ready Captain.'
say ''
do until c = 0
say 'Vectors Captain?'
pull dx dy
if dx = '' then dx = 0
if dy = '' then dy = 0
if (dx = -1 | dx = 0 | dx = 1) & (dy = -1|dy = 0|dy = 1) then c = 0
else
do
c = 1
say ''
say 'Jim are you feeling all right? You know what a vector is!'
end
end
tx = ex
ty = ey
do lp = 0 to 9
t0 = tx+dx
t1 = ty+dy
if (t0 < 0) | (t0 > 9) | (t1 < 0) | (t1 > 9) then do
say ''
say ' Torpedoe missed sir!'
say ''
return
end
space = quad.t0.t1
if space ~= 0 then select
when space = 2 then do
say '*** Torpedoe hits a STAR ***'
say ''
return
end
when space = 3 then do
say '*** Torpedo hits a KLINGON ***'
say '*** KLINGON DESTROYED ***'
say 'Good shot Captain!'
quad.t0.t1 = 0
map.x.y = map.x.y - 100
kltot = kltot - 1
points = points + 100
return
end
when space = 4 then do
say '*** Torpedoe hits a BASE ***'
say 'COURT MARTIAL IS IMMENENT!'
return
end
otherwise do
say '*** Torpedoe hits the DEATHSTAR ***'
say 'Torpedoe seems to have no affect!'
return
end
end
quad.t0.t1 = 6
tx = t0
ty = t1
'cls'
call print_quadrent
quad.tx.ty = 0
end
end
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE WEAR_AND_TEAR */
/* PASSED VALUES - none */
/* ********************************************** */
/* ********************************************** */
wear_and_tear:
pick = random(0,5)
if docked = 'yes' then
if status.pick = 0 then return
else status.pick = status.pick - .1
else if status.pick < 1 then do
status.pick = status.pick + .1
if status.pick = 1 then do
say 'Status report sir -'
select
when pick = 0 then say 'Computer is in need of repair!'
when pick = 1 then say 'Phasers are in need of repair!'
when pick = 2 then say 'Torpedoes are in need of repair!'
when pick = 3 then say 'Warp Drive is in need of repair!'
when pick = 4 then say 'Impulse Drive is in need of repair!'
when pick = 5 then say 'Sensors are out of order!'
end
if status.3 > .9 & status.4 > .9 then do
say ''
say 'Captain sir ... we seem to be dead in space!'
say 'The warp drive and the impulse drive are out!'
say ''
alive = 'no'
end
end
end
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE engine_control */
/* PASSED VALUES - power */
/* ********************************************** */
/* ********************************************** */
engine_control:
arg power
say 'Scotty here captain.'
if power = 'WAR' then do
if status.3 > 1.2 then return
say 'What Warp factor Captain?'
pull warp
if warp = '' then warp = 0
do forever
say 'Destination?'
parse pull dx ',' dy
if datatype(dx,'W') & datatype(dy,'W') then leave
say 'Where?'
end
if x > 9 | y < 0 | x < 0 | y > 9 then do
energy = energy - 5000
say 'Captain the warp drive is in a bad way!'
say 'And we are losing energy fast!'
end
/* if warp drive damaged degrade efficiency of energy consumption */
energy = energy - ((((dx-x)**2 + (dy-y)**2)/2.5)*1000+status.3*5000)
if dx > 9 | dy < 0 | dx < 0 | dy > 9 then do
say ''
say 'Warping out of the galaxy is not a good idea.'
say ''
if shields = 'down' then do
say ' SHIELDS are DOWN --- the ENTERPRIZE is caught, in the void of intergalatic space'
say ' Damage control report - WARP drive damaged,Impulse drive damaged, sensors out!'
status.3 = status.3 + 1
status.4 = status.4 + 1
status.5 = 1.1
end
else energy = energy - 5000
end
x = dx
y = dy
if x > -1 & x < 10 & y > -1 & y < 10 then call newscreen
end
else
do
if power ~= 'IMP' | status.4 > .9 then do
say ''
say ' Im a sorrye Captin, I canna do That!'
say ''
return
end
else
do
say ''
say 'Aye Captain - Impulse power it is'
say 'What factor Captain?'
do forever
pull factor
if datatype(factor,'W') then leave
say 'Whats that Captain?'
end
if factor <= 0 & num = 'yes' then return
do until c = 0
say 'Vectors Captain?'
pull dx dy
if dx = '' then dx = 0
if dy = '' then dy = 0
if (dx = -1 | dx = 0 | dx = 1) & (dy = -1|dy = 0|dy = 1) then c = 0
else
do
c = 1
say ''
say 'Jim are you feeling all right? You know what a vector is!'
end
end
do i = 0 to factor - 1
if ((ex+dx) < 0) | ((ex+dx) > 9) | ((ey+dy) < 0) |((ey+dy) > 9) then
do
say ''
say ' You have to use the Warp drive to exit the quadrent sir!'
say ''
return
end
t0 = ex+dx
t1 = ey+dy
space = quad.t0.t1
if space ~= 0 then select
when space = 2 then do
say '*** COLLISION with STAR ***'
say 'Its a hot time in the old ship tonight!'
alive = 'no'
end
when space = 3 then do
say '*** COLLISION with KLINGON ***'
say 'This wont do your complection any good at all!'
alive = 'no'
end
when space = 4 then do
say '*** COLLISION with BASE ***'
say 'I dont think you will see your paycheck this week!'
alive = 'no'
end
otherwise do
say '*** SWALLOWED BY THE DEATHSTAR ***'
say 'Johova you are not.'
alive = 'no'
end
end
quad.ex.ey = 0
quad.t0.t1 = 1
ex = t0
ey = t1
if alive = 'yes' then do
'cls'
call print_quadrent
end
end
end
end
/* Got to check to see if Enterprize is docked */
dock?:
docked = 'no'
do i1 = -1 to 1
do j1 = -1 to 1
if i1+ex > -1 & i1+ex < 10 & j1+ey > -1 & j1+ey < 10 then do
ta = i1+ex
tb = j1+ey
if quad.ta.tb = 4 then do
docked = 'yes'
t = status.0 + status.1 + status.2 + status.3 + status.4 + status.5
stardate = stardate + t
status.0 = 0
status.1 = 0
status.2 = 0
status.3 = 0
status.4 = 0
status.5 = 0
end
end
end
end
if kltot = 0 then missstat = 'completed'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE SAVE_GAME */
/* PASSED VALUES - filename */
/* ********************************************** */
/* ********************************************** */
save_game:
arg file
if file = 'GAM' then
do
say 'Enter filename'
pull fn
if fn = '' then fn = 'startrek.saved'
end
else fn = 'startrek.saved'
missstat = 'not yet'
/* save variables */
if ~Open(fnn,fn,'W') then do
say '***Open return code = ' rc
say 'File may be in use, or is unable to be opened. Try again.'
return
end
say 'Saving startrek in file ' fn
push stardate mission energy points x y ex ey shields klshields docked kltot
pull outt
if Writeln(fnn,outt) < 1 then exit -99
push status.0 status.1 status.2 status.3 status.4 status.5
pull outt
if Writeln(fnn,outt) < 1 then exit -99
/* Load galactic map */
do l = 0 to 9
push map.l.0 map.l.1 map.l.2 map.l.3 map.l.4
push map.l.5 map.l.6 map.l.7 map.l.8 map.l.9
pull outt
if Writeln(fnn,outt) < 1 then exit -99
pull outt
if Writeln(fnn,outt) < 1 then exit -99
end
do l = 0 to 9
push quad.l.0 quad.l.1 quad.l.2 quad.l.3 quad.l.4
push quad.l.5 quad.l.6 quad.l.7 quad.l.8 quad.l.9
pull outt
if Writeln(fnn,outt) < 1 then exit -99
pull outt
if Writeln(fnn,outt) < 1 then exit -99
end
if ~Close(fnn) then exit -99
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE SENSORS */
/* PASSED VALUES - type */
/* ********************************************** */
/* ********************************************** */
sensors:
arg type
if type = 'LON' & status.5 < 1.1 then do
do i = -1 to 1
say '-------------------'
line = ': '
do j = -1 to 1
t0 = x+i
t1 = y+j
if t0 < 0 | t0 > 9 | t1 < 0 | t1 > 9 then line = line || 'XXX :'
else
do
if map.t0.t1 < 100 & map.t0.t1 > 9 then line = line || ' '
if map.t0.t1 < 10 then line = line || ' '
line = line || map.t0.t1 || ' :'
end
end
say line
end
end
else
if status.5 > 1 then do
say ' Long-range Sensors are out captain !!'
say ''
end
else say ' Sense this ....'
say '-------------------'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE SHIELD_CONTROL */
/* PASSED VALUES - direction */
/* ********************************************** */
/* ********************************************** */
shield_control:
arg direction
if direction = 'RAI' then
if shields = 'UP' then do
say 'But the shields are already up Captain!'
say ''
say ''
end
else
do
shields = 'UP'
say 'Deflectors up Captain'
energy = energy - 3000
end
else
if direction = 'LOW' then
if shields = 'down' then do
say 'But the shields are already down Captain!'
say ''
say ''
end
else
do
shields = 'down'
say 'Shields down Captain'
energy = energy + 3000
end
else
do
say ' I am confused by that order Captain.'
return
end
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE DISPLAY_INFO */
/* PASSED VALUES - what */
/* ********************************************** */
/* ********************************************** */
display_info:
arg what
if what = 'STA' then do
'cls'
say ''
say ' Status report for Enterprize - Stardate ' stardate
say ' ----------------------------------'
c = 100 - status.0*100
say ' Computer status ' c'%'
say ' ----------------------------------'
c = 100 - status.1*100
say ' Phasers status ' c'%'
say ' ----------------------------------'
c = 100 - status.2*100
say ' Torpedoes status ' c'%'
say ' ----------------------------------'
c = 100 - status.3*100
say ' Warp drive status ' c'%'
say ' ----------------------------------'
c = 100 - status.4*100
say ' Impulse drive status ' c'%'
say ' ----------------------------------'
c = 100 - status.5*100
say ' Sensors status ' c'%'
say ' ----------------------------------'
'wait 10 sec'
end
else say 'Sorry Captain ... that has not been installed yet!'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE INSTRUCTIONS */
/* PASSED VALUES - none */
/* ********************************************** */
/* ********************************************** */
instructions:
'cls'
say 'STARTREK INSTRUCTIONS'
say ''
say 'Welcome to the world of Startrek! I hope you have a nice stay.'
say 'These instructions are not complete yet, because the game is'
say 'still evolving, but you should get the jist of things.'
say ''
say 'YOUR MISSION:'
say ' There are plans for 10 different missions in the game. Your'
say 'job will be to complete them as best as you can and accumulate'
say 'as many points as possible. Points are awarded based on the'
say 'mission objective.'
say ''
say 'THE SCREEN:'
say ' Firstoff the screen is a 10 by 10 matrix with 0,0 being in the'
say 'upper left hand corner and 9,9 in the lower right. The horizontal'
say 'axis is the first number and the vertical is the second for spacial
'
say 'representations. This also goes for the galaxy matrix as a hole.'
say ' Second is the status conditions on the right hand side of the'
say 'screen whitch depicts some useful information at a glance. If you'
say 'are familiar with the STARTREK series at all they are self explanatory'
say ' hit return to continue '
pull junk
'cls'
say 'THE COMMAND LINE:'
say ' The command line will accept english words for actions you wish'
say 'to do. For example if you wish to shoot at a klingon all you have'
say 'to say is "fire phasers". There is a two word limit for any'
say 'particular command and a three command limit.'
say 'What follows are some of the words STARTREK will recognize.'
say ''
say ' RAISE WARP DISPLAY CAPTAIN LAUNCH TRANSPORT SHIP'
say ' FIRE IMPULSE SHORT_RANGE COMPUTER PHASERS LONG_RANGE DOWN'
say ' LOG PROBE TORPEDOES LOWER HELP INSTRUCTIONS SAVE'
say ' GAME QUIT STATUS MAP SENSORS DRIVE SHIELDS'
say ''
say 'These are all that STARTREK will understand currently and some'
say 'have as of yet not been implemented.'
say 'Certain commands such as QUIT, SAVE, HELP, INSTRUCTIONS are'
say 'single word commands. The descriptions of these four follow.'
say ''
say 'QUIT : Terminates the game with extreme predjudice.'
say ''
say 'SAVE {GAME} : saves startrek for future play.'
say ' hit return to continue '
pull junk
'cls'
say 'SAVE {GAME} continued'
say 'If the option GAME is entered you will be prompted for a filename.'
say 'If SAVE is entered without arguments {eg GAME} then the file is'
say 'saved in a CMS file called STARTREK SAVED A.'
say ''
say 'HELP or INSTRUCTIONS: this must be obvious since you are running'
say 'this routine (duh).'
say ''
say 'IN ORDER TO STAY ALIVE you must NOT, run out of energy, exceed'
say 'Stardate 5000.0 for each mission, or be caught with your'
say 'gaurd down (hint).'
say ''
say 'One final note: commands are only checked for the first three'
say 'characters in each string and the rest is ignored.'
say ''
say 'Well (as Ronnie would say) may the Force be with you!'
say ''
say ' Whoops wrong decade! Anyway good luck!'
say ' hit return to continue'
pull junk
'cls'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE CAPTAINS_LOG */
/* PASSED VALUES - word2 */
/* ********************************************** */
/* ********************************************** */
captains_log:
say 'Sorry, I havent done this command yet! Any suggestions?'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE LAUNCH_PROBE */
/* PASSED VALUES - word2 */
/* ********************************************** */
/* ********************************************** */
launch_probe:
say 'Sorry, I havent done this command yet! Any suggestions?'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE COMPUTE */
/* PASSED VALUES - word2 */
/* ********************************************** */
/* ********************************************** */
compute:
say 'Sorry, I havent done this command yet! Any suggestions?'
return
/* ********************************************** */
/* ********************************************** */
/* SUBROUTINE MISSION1 */
/* PASSED VALUES - none */
/* ********************************************** */
/* ********************************************** */
mission1:
/* make the klingons active aggressors */
/* Mission 1 - WAR with the KLINGONS! */
/* Any Klingons in the sector? */
if map.x.y > 99 then do
do i = 0 to 9 /* locate the klingon in the quadrent */
do j = 0 to 9
if quad.i.j = 3 then
do
tx = i
ty = j
end
end
end
/* got him - now move and fire */
if tx > ex then t0 = -1
if tx = ex then t0 = 0
if tx < ex then t0 = 1
if ty > ey then t1 = -1
if ty = ey then t1 = 0
if ty < ey then t1 = 1
/* now how much? */
factor = ((tx-ex)**2 + (ty-ey)**2)
do i = 1 to 13 by .5
tm = factor/i
if tm < i then leave
end
factor = i%1
/* now move him */
kl = 'yes'
do i = 0 to factor - 1
if factor < 1 then leave
t2 = tx+t0
t3 = ty+t1
if t2 < 0 | t2 > 9 | t3 < 0 | t3 > 9 then leave
space = quad.t2.t3
if space = 1 then leave
if space ~= 0 & kl = 'yes' then select
when space = 2 then do
say '*** KILINGON COLLIDES with STAR ***'
say 'Gee ... that was pretty dumb huh?'
quad.tx.ty = 0
map.x.y = map.x.y - 100
kltot = kltot - 1
kl = 'no'
end
when space = 3 then do
say '*** KLINGON COLLIDES with KLINGON ***'
say 'Ha ha ha. Wow they are stupid!'
quad.tx.ty = 0
quad.t2.t3 = 0
map.x.y = map.x.y - 200
kltot = kltot - 2
kl = 'no'
end
when space = 4 then do
say '*** KLINGON COLLIDES with BASE ***'
say 'I wonder if they yelled BONZAI!'
quad.tx.ty = 0
quad.t2.t3 = 0
map.x.y = map.x.y - 100
kltot = kltot - 1
kl = 'no'
end
otherwise
do
say space
say '*** KLINGON EATEN FOR LUNCH! ***'
say 'The deathstar will probably have indesgestion.'
points = points + 50
quad.tx.ty = 0
map.x.y = map.x.y - 100
kltot = kltot - 1
kl = 'no'
end
end
if kl = 'yes' then do
quad.tx.ty = 0
quad.t2.t3 = 3
tx = t2
ty = t3
'cls'
call print_quadrent
end
end
if docked = 'yes' then return
/* now fire */
if kl = 'yes' then do
amount = klshields/5000 * random(100,500) * 10
if amount > 1000 & shields = 'down' then do
say ''
say '--- KLINGON FIRES PHASERS ---'
say '*** ENTERPRIZE SHIELDS ARE DOWN ***'
say '*** ENTERPRIZE HIT with 'amount ' UNITS of energy.'
say '*** ENTERPRIZE DESTROYED ***'
alive = 'no'
say ''
end
if amount < 3000 & shields = 'UP' then do
say ''
say '--- KLINGON FIRES PHASERS ---'
say '*** ENTERPRIZE SHIELDS ARE UP '
say '*** DEFLECTORS Absorbe impact --- no Damage ***'
say ''
energy = energy - amount
end
if amount > 3000 & shields = 'UP' then do
say ''
say '--- KLINGON FIRES PHASERS ---'
say '*** ENTERPRIZE SHIELDS ARE UP '
hit = amount - 3000
say '*** ENTERPRIZE HIT WITH' hit ' UNITS OF ENERGY'
say ''
energy = energy - amount
do i = 0 to hit/100
call wear_and_tear
end
end
if amount < 1001 & shields = 'down' then do
say ''
say '--- KLINGON FIRES PHASERS ---'
say '*** ENTERPRIZE SHIELDS ARE DOWN '
hit = amount
say '*** ENTERPRIZE HIT WITH' hit ' UNITS OF ENERGY'
say ''
do i = 0 to hit/100
call wear_and_tear
end
end
end
end
/* end for Klingons in sector ... if < 3 here go get some */
if map.x.y < 299 & alive = 'yes' then do
found = 'no'
do i = -1 to 1 /* locate a klingon in the Galaxy */
do j = -1 to 1
tx = i+x
ty = j+y
if (tx > -1) & (tx < 10) & (ty > -1) & (ty < 10) then do
if (map.tx.ty > 99) & ((i ~=0 )|(j ~=0 )) then do
found = 'yes'
i = 1
j = 1
end
end
end
end
if found = 'yes' then do
say ' CAPTAIN a Klingon warship has just warped into the quadrent!'
map.tx.ty = map.tx.ty - 100
map.x.y = map.x.y + 100
do until a = 1
rx = random(0,9)
ry = random(0,9)
if quad.rx.ry = 0 then do
quad.rx.ry = 3
a = 1
end
else a = 0
end
end
end
if kltot = 0 then missstat = 'completed'
return
/* MISSION 2 */
init_variables_2:
return
mission2:
return
/* MISSION3 */
init_variables_3:
return
mission3:
/* MISSION4 */
init_variables_4:
return
mission4:
/* MISSION5 */
init_variables_5:
return
mission5:
/* MISSION6 */
init_variables_6:
return
mission6:
/* MISSION7 */
init_variables_7:
return
mission7:
/* MISSION8 */
init_variables_8:
return
mission8:
/* MISSION9 */
init_variables_9:
return
mission9:
/* MISSION10 */
init_variables_10:
return
mission10: